/*
package com.honglu.backend.dubbo.impl;

import org.apache.commons.lang.StringUtils;
import org.springframework.beans.BeanUtils;
import org.springframework.beans.factory.annotation.Autowired;

import com.alibaba.dubbo.config.annotation.Service;
import com.honglu.backend.dubbo.ApplicationDubboService;
import com.honglu.backend.dubbo.response.DubboBaseResponse;
import com.honglu.backend.entity.Application;
import com.honglu.backend.entity.ApplicationDubboServiceBean;
import com.honglu.backend.service.CustomerService;
import com.honglu.backend.service.impl.ApplicationServiceImpl;

//注册为 Dubbo 服务
@Service(version = "1.0.0")
public class ApplicationDubboServiceImpl implements ApplicationDubboService {

	@Autowired
	private ApplicationServiceImpl applicationService;
	
	@Autowired
	private CustomerService customerService;
	
	@Override
	public DubboBaseResponse saveEntity(ApplicationDubboServiceBean applicationDubboServiceBean) {
		DubboBaseResponse response = new DubboBaseResponse();
		if (applicationDubboServiceBean == null) {
			response.setState("failure");
			response.setErrorCode("parameter_is_null");
			response.setErrorMsg("传入参数为空");
			return response;
		}
		// 客户信息保存
		boolean customerSaveFlag = saveCustomer(applicationDubboServiceBean);
		
		if (!customerSaveFlag) {
			response.setState("failure");
			response.setErrorCode("save_failure");
			response.setErrorMsg("客户信息保存失败");
			return response;
		}
				
		// 订单数据保存
		saveApplication(applicationDubboServiceBean, response);
		
		return response;
	}
	
	*/
/**
	 * 申请单信息保存
	 * @param applicationDubboServiceBean
	 * @return
	 *//*

	private void saveApplication(ApplicationDubboServiceBean applicationDubboServiceBean, DubboBaseResponse response) {
		if (applicationDubboServiceBean.getApplicationBean() == null 
				|| StringUtils.isEmpty(applicationDubboServiceBean.getApplicationBean().getAppSerialNumber())) {
			response.setState("failure");
			response.setErrorCode("parameter_is_null");
			response.setErrorMsg("传入申请单对象为空，或APP应用请求流水号为空");
			return;
		}
		Application application = applicationService.getEntityById(applicationDubboServiceBean.getApplicationBean().getAppSerialNumber());
		if (application != null) {
			response.setState("failure");
			response.setErrorCode("application_already_exists");
			response.setErrorMsg("已存在对应APP应用请求流水号申请单信息");
			return;
		}
		// 订单数据保存
		application = new Application();
		BeanUtils.copyProperties(applicationDubboServiceBean.getApplicationBean(), application);
		boolean flag = applicationService.saveEntity(application);
		if (flag) {
			response.setState("success");
		} else {
			response.setState("failure");
			response.setErrorCode("save_failure");
			response.setErrorMsg("申请单数据保存失败");
		}
	}
	
	*/
/**
	 * 客户信息保存
	 * @param applicationDubboServiceBean
	 * @return
	 *//*

	private boolean saveCustomer(ApplicationDubboServiceBean applicationDubboServiceBean) {
		return customerService.save(applicationDubboServiceBean.getCuCustomerOtherList(), applicationDubboServiceBean.getCuIcePersonList(), 
				applicationDubboServiceBean.getCuPlatformCustomer(), applicationDubboServiceBean.getCuCustomerCompany());
	}

}
*/
